<?php

namespace App\Http\Validate\OpenShop\SiteLocation;

use App\Http\Validate\BaseValidate;

/**
 * [ 提交选址 ] - 校验规则
 *
 * @CustomerAnalysisValidate
 * @package App\Http\Controllers
 * @date 2022/04/26 02:35:56
 * @author huang
 */
class CustomerAnalysisValidate extends BaseValidate
{


    static function registerValidateRules(): void
    {
        // TODO: Implement registerValidateRules() method.
    }

    static function getRules(array $fields = []): array
    {
        return [
            'id'                          => '',
            'time'                        => 'sometimes|string|date_format:Y-m-d',
            'week'                        => '',
            'dateType'                    => '',
            'weather'                     => '',
            'temperature'                 => '',
            'afternoonNumber'             => '',
            'afternoonYoungProportion'    => '',
            'afternoonTeaNumber'          => '',
            'afternoonTeaYoungProportion' => '',
            'nightNumber'                 => '',
            'nightYoungProportion'        => '',
            'nightSnackNumber'            => '',
            'nightSnackYoungProportion'   => '',
            'afternoonPhoto'              => 'array',
            'afternoonTeaPhoto'           => 'array',
            'nightPhoto'                  => 'array',
            'nightSnackPhoto'             => 'array',
        ];
    }

    public static array $attributes = [
        'id'                          => '主键Id',
        'time'                        => '日期',
        'week'                        => '星期',
        'dateType'                    => '日期类型',
        'weather'                     => '天气',
        'temperature'                 => '温度',
        'afternoonNumber'             => '午市人数',
        'afternoonYoungProportion'    => '午市年轻占比',
        'afternoonTeaNumber'          => '下午茶人数',
        'afternoonTeaYoungProportion' => '下午车年轻占比',
        'nightNumber'                 => '晚市人数',
        'nightYoungProportion'        => '晚市年轻人占比',
        'nightSnackNumber'            => '宵夜人数',
        'nightSnackYoungProportion'   => '宵夜年轻人照壁',
        'afternoonPhoto'              => '午时照片',
        'afternoonTeaPhoto'           => '下午茶照片',
        'nightPhoto'                  => '晚市照片',
        'nightSnackPhoto'             => '宵夜照片',
    ];

    public static function handelData(array $requestParams)
    {
        $data = [];
        foreach ($requestParams['customerAnalysis'] as $value) {
            $data[] = self::submitValidate($value);
        }
        return $data;
    }

    public static function submitValidate(array $requestParams): array
    {
        return self::baseValidate(
            $requestParams,
            array_keys(self::getRules()),
            null,
            null,
            self::getValidateMsg()
        );
    }


}
